var mapIds = [744000001, 744000002, 744000003, 744000004, 744000005, 744000006, 744000007, 744000008, 744000009, 744000010, 744000011, 744000012, 744000013, 744000014, 744000015, 744000016];
var 准备地图 = 744000000;

function init() {}

function setup(c, a) {
    var c = em.newInstance("副本_枫之高校");
    for (var b = 744000000 + 1; b <= 744000000 + 16; b++) {
        var d = c.setInstanceMap(b);
        d.resetFully();
        d.killAllMonsters(false)
    }
    c.setProperty("state", 1);
    c.initPropArrayRandom("next_map", 3, 15, 10);
    initPropArray(c, "map", "", 1, 16);
    initProp(c, "next_map_11", 1);
    initProp(c, "next_map_12", 16);
    initProp(c, "kill", 0);
    return c
}

function onPlayerRegistered(b, a) {
    var d = b.getNumberProperty("next_map_1");
    var c = b.getMapInstance(d - 1);
    a.changeMap(c, c.getPortal(0))
}

function onPlayerRevived(b, a) {
    return false
}

function onMapChanged(c, b, a) {
    if (mapIds.indexOf(a) < 0) {
        on玩家退场(c, b, false);
        return
    }
    c.setProperty("kill", 0);
    c.startEventTimer(5 * 60 * 1000)
}

function onPlayerDisconnected(b, a) {
    on玩家退场(b, a, false);
    return 0
}

function onTimeOut(a) {
    a.getPlayers().forEach(function (b) {
        on玩家退场(a, b, true)
    })
}

function onMonsterKilled(c, d) {
    var b = c.getNumberProperty("kill") + 1;
    c.setProperty("kill", b);
    var a = player.getMapId() - 744000000;
    if (a == 5) {
        var f = 3
    } else {
        if (a == 6 || a == 10) {
            var f = 20
        } else {
            if (a == 9) {
                var f = 21
            } else {
                var f = 1
            }
        }
    }
    if (b < f) {
        return
    }
    var a = player.getMapId() - 744000000;
    var e = c.getMapFactoryMap(a + 744000000);
    switch (a) {
        case 1:
            e.spawnNpc(9330192, new java.awt.Point(177, 240));
            player.getMap().startSimpleMapEffect("让我看看你从和朋友的对决那里学到了什么吧。", 5120120);
            break;
        case 2:
            e.spawnNpc(9330192, new java.awt.Point(177, 240));
            player.getMap().startSimpleMapEffect("让我看看你从和朋友的对决那里学到了什么吧。", 5120120);
            break;
        case 3:
            e.spawnNpc(9330192, new java.awt.Point(177, 240));
            player.getMap().startSimpleMapEffect("让我看看你从候补校长那里学到了什么吧。", 5120120);
            break;
        case 4:
            e.spawnNpc(9330192, new java.awt.Point(177, 240));
            break;
        case 5:
            e.spawnNpc(9330192, new java.awt.Point(177, 240));
            player.getMap().startSimpleMapEffect("算你好运。居然躲掉接种预防针？下次不会放过你。", 5120120);
            break;
        case 6:
            player.getMap().startSimpleMapEffect("谢谢你帮助我~", 5120076);
            c.setProperty("map_" + a, "done");
            break;
        case 7:
            e.spawnNpc(9330192, new java.awt.Point(177, 240));
            player.getMap().startSimpleMapEffect("让我看看你从库梅老师那里学到了什么吧。", 5120120);
            break;
        case 8:
            e.spawnNpc(9330192, new java.awt.Point(177, 240));
            break;
        case 9:
            player.getMap().startSimpleMapEffect("真是太感谢你了！", 5120020);
            c.setProperty("map_" + a, "done");
            break;
        case 10:
            e.spawnNpc(9330192, new java.awt.Point(390, 240));
            player.getMap().startSimpleMapEffect("全……全部力量结合起来。总……总有一天会成为朋友……", 5120066);
            break;
        case 11:
            e.spawnNpc(9330187, new java.awt.Point(276, 189));
            player.getMap().startSimpleMapEffect("授课已经结束了。接受物理老师的考核吧。", 5120071);
            break;
        case 12:
            e.spawnNpc(9330188, new java.awt.Point(3, 58));
            player.getMap().startSimpleMapEffect("授课已经结束了。接受历史老师的考核吧。", 5120070);
            break;
        case 13:
            e.spawnNpc(9330192, new java.awt.Point(177, 240));
            player.getMap().startSimpleMapEffect("呼~太手下留情了，下次一定要把你带走！", 5120072);
            break;
        case 14:
            e.spawnNpc(9330192, new java.awt.Point(177, 240));
            player.getMap().startSimpleMapEffect("真是的……不允许有社员比社长还强。不准入社！", 5120075);
            break;
        case 15:
            e.spawnNpc(9330192, new java.awt.Point(177, 240));
            player.getMap().startSimpleMapEffect("不懂艺术……音乐部不需要你……", 5120074);
            break;
        case 16:
            player.getMap().startSimpleMapEffect("你今天的学习已经圆满结束了。可以放学了。", 5120120);
            e.spawnNpc(9330192, new java.awt.Point(177, 240));
            c.setProperty("state", 100);
            break
    }
    return 1
}

function onPlayerRevived(b, a) {
    return false
}

function onPartyDisbanded(a) {}

function onPlayerKilled(b, a) {}
var setupTask;

function randomNum(b, a) {
    switch (arguments.length) {
        case 1:
            return parseInt(Math.random() * b + 1, 10);
            break;
        case 2:
            return parseInt(Math.random() * (a - b + 1) + b, 10);
            break;
        default:
            return 0;
            break
    }
}

function initProp(b, a, c) {
    if (b.getProperty(a) == null) {
        b.setProperty(a, c)
    }
}

function initPropArray(c, a, e, d, f) {
    for (var b = d; b <= f; b++) {
        if (c.getProperty(a + "_" + b) == null) {
            c.setProperty(a + "_" + b, e)
        }
    }
}

function on玩家退场(c, b, a) {
    c.disposeIfPlayerBelow(a ? 999 : 0, 准备地图);
    c.getProperties().clear();
    em.setProperty("state", 0);
    em.setProperty("leader", "true");
    c.unregisterPlayer(b)
}

function passRoom5() {
    var a = a.getInstance("副本_枫之高校");
    var b = a.getMapFactoryMap(5 + 744000000);
    b.spawnNpc(9330192, new java.awt.Point(177, 240))
};